# Copyright (C) 2004 Stefan Bellon <sbellon@sbellon.de>
#
# This file is part of RemotePrinterFS.
#
# RemotePrinterFS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# RemotePrinterFS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA

CC         = cc
CC_FLAGS   = -throwback -IC:,OSLib:,TCPIPLibs: -c -zM -zps0 -ffa -Wp
LD         = link
LD_FLAGS   =
CMHG       = cmhg
CMHG_FLAGS = -throwback -IC:,OSLib:,TCPIPLibs: -p
DEPEND     = -depend !Depend

OBJS =  o.connection     \
	o.conn_jetdirect \
	o.conn_lpd       \
	o.conn_spool     \
	o.errors         \
	o.fsentries      \
	o.rpfs           \
	o.module         \
	o.ro_base        \
	o.syslogf        \
	o.utils
	

LIBS =  TCPIPLibs:o.inetlibzm \
	TCPIPLibs:o.unixlibzm \
	TCPIPLibs:o.socklibzm \
	OSLib:o.OSLib32 \
	C:o.stubs

.INIT:
	@cdir o

.PHONY: all dist clean

## Rule Patterns ##

.SUFFIXES: .c .o .s

.c.o:;	$(CC) $(CC_FLAGS) $(DEPEND) -c -o $@ $<
.s.o:;	$(CC) $(CC_FLAGS) $(DEPEND) -c -o $@ $<

# Static dependencies:

all: RPFS

dist: rpfs/zip rpfssrc/zip

clean:
	-ifthere o.* then wipe o.* ~CFR~V
	-ifthere RPFS then wipe RPFS ~CFR~V
	-ifthere rpfs/zip then wipe rpfs/zip ~CFR~V
	-ifthere rpfssrc/zip then wipe rpfssrc/zip ~CFR~V
	-ifthere lpd_serv then wipe lpd_serv ~CFR~V
	-ifthere h.rpfs then wipe h.rpfs ~CFR~V

RPFS: $(OBJS) rpfs.h
	$(LD) -o RPFS -rmf $(OBJS) $(LIBS)

rpfs.h rpfs.o: rpfs.cmhg
	$(CMHG) $(CMHG_FLAGS) $(DEPEND) rpfs.cmhg -o rpfs.o -d rpfs.h

lpd_serv: o.lpd_serv
	$(LD) -o lpd_serv o.lpd_serv $(LIBS)

rpfs/zip: dist.RPFS.RPFS
	-ifthere rpfs/zip then wipe rpfs/zip ~CFR~V
	-copy COPYING dist.COPYING ~CFR~V
	-dir dist
	-zip -r9 ^.rpfs/zip * -x *CVS* */cvsignore*
	-up
	-wipe dist.COPYING ~CFR~V

rpfssrc/zip:
	-ifthere rpfssrc/zip then wipe rpfssrc/zip ~CFR~V
	-zip -r9 rpfssrc/zip c ChangeLog cmhg COPYING dist h Makefile s -x *CVS* */cvsignore* dist.RPFS.RPFS

dist.RPFS.RPFS: RPFS
	-copy RPFS dist.RPFS.RPFS ~CFR~V

# Dynamic dependencies:
o.connection:	c.connection
o.connection:	h.connection
o.connection:	OSLib:oslib.h.os
o.connection:	OSLib:oslib.h.types
o.connection:	OSLib:oslib.h.oscore32
o.connection:	OSLib:oslib.h.osf32
o.connection:	h.conn_jetdirect
o.connection:	h.conn_lpd
o.connection:	h.conn_spool
o.connection:	h.errors
o.connection:	OSLib:oslib.h.os
o.connection:	h.syslogf
o.connection:	h.utils
o.connection:	OSLib:oslib.h.types
o.conn_jetdirect:	c.conn_jetdirect
o.conn_jetdirect:	TCPIPLibs:h.unistd
o.conn_jetdirect:	TCPIPLibs:sys.h.cdefs
o.conn_jetdirect:	TCPIPLibs:sys.h.types
o.conn_jetdirect:	TCPIPLibs:sys.h.cdefs
o.conn_jetdirect:	TCPIPLibs:machine.h.endian
o.conn_jetdirect:	TCPIPLibs:machine.h.ansi
o.conn_jetdirect:	TCPIPLibs:machine.h.types
o.conn_jetdirect:	TCPIPLibs:sys.h.unistd
o.conn_jetdirect:	TCPIPLibs:sys.h._posix
o.conn_jetdirect:	TCPIPLibs:h.socklib
o.conn_jetdirect:	TCPIPLibs:sys.h.types
o.conn_jetdirect:	TCPIPLibs:sys.h.socket
o.conn_jetdirect:	TCPIPLibs:sys.h.cdefs
o.conn_jetdirect:	TCPIPLibs:sys.h.stat
o.conn_jetdirect:	TCPIPLibs:sys.h.time
o.conn_jetdirect:	TCPIPLibs:sys.h.cdefs
o.conn_jetdirect:	TCPIPLibs:sys.h.cdefs
o.conn_jetdirect:	TCPIPLibs:sys.h.time
o.conn_jetdirect:	TCPIPLibs:sys.h.uio
o.conn_jetdirect:	TCPIPLibs:sys.h.cdefs
o.conn_jetdirect:	C:h.kernel
o.conn_jetdirect:	TCPIPLibs:h.inetlib
o.conn_jetdirect:	TCPIPLibs:sys.h.types
o.conn_jetdirect:	TCPIPLibs:netinet.h.in
o.conn_jetdirect:	TCPIPLibs:h.netdb
o.conn_jetdirect:	TCPIPLibs:sys.h.cdefs
o.conn_jetdirect:	h.config
o.conn_jetdirect:	h.rpfs
o.conn_jetdirect:	h.errors
o.conn_jetdirect:	OSLib:oslib.h.os
o.conn_jetdirect:	OSLib:oslib.h.types
o.conn_jetdirect:	OSLib:oslib.h.oscore32
o.conn_jetdirect:	OSLib:oslib.h.osf32
o.conn_jetdirect:	h.syslogf
o.conn_jetdirect:	h.utils
o.conn_jetdirect:	OSLib:oslib.h.types
o.conn_lpd:	c.conn_lpd
o.conn_lpd:	TCPIPLibs:h.unistd
o.conn_lpd:	TCPIPLibs:sys.h.cdefs
o.conn_lpd:	TCPIPLibs:sys.h.types
o.conn_lpd:	TCPIPLibs:sys.h.cdefs
o.conn_lpd:	TCPIPLibs:machine.h.endian
o.conn_lpd:	TCPIPLibs:machine.h.ansi
o.conn_lpd:	TCPIPLibs:machine.h.types
o.conn_lpd:	TCPIPLibs:sys.h.unistd
o.conn_lpd:	TCPIPLibs:sys.h._posix
o.conn_lpd:	TCPIPLibs:h.socklib
o.conn_lpd:	TCPIPLibs:sys.h.types
o.conn_lpd:	TCPIPLibs:sys.h.socket
o.conn_lpd:	TCPIPLibs:sys.h.cdefs
o.conn_lpd:	TCPIPLibs:sys.h.stat
o.conn_lpd:	TCPIPLibs:sys.h.time
o.conn_lpd:	TCPIPLibs:sys.h.cdefs
o.conn_lpd:	TCPIPLibs:sys.h.cdefs
o.conn_lpd:	TCPIPLibs:sys.h.time
o.conn_lpd:	TCPIPLibs:sys.h.uio
o.conn_lpd:	TCPIPLibs:sys.h.cdefs
o.conn_lpd:	C:h.kernel
o.conn_lpd:	TCPIPLibs:h.inetlib
o.conn_lpd:	TCPIPLibs:sys.h.types
o.conn_lpd:	TCPIPLibs:netinet.h.in
o.conn_lpd:	TCPIPLibs:h.netdb
o.conn_lpd:	TCPIPLibs:sys.h.cdefs
o.conn_lpd:	h.config
o.conn_lpd:	h.rpfs
o.conn_lpd:	h.errors
o.conn_lpd:	OSLib:oslib.h.os
o.conn_lpd:	OSLib:oslib.h.types
o.conn_lpd:	OSLib:oslib.h.oscore32
o.conn_lpd:	OSLib:oslib.h.osf32
o.conn_lpd:	h.syslogf
o.conn_lpd:	h.utils
o.conn_lpd:	OSLib:oslib.h.types
o.conn_spool:	c.conn_spool
o.conn_spool:	OSLib:oslib.h.osfile
o.conn_spool:	OSLib:oslib.h.types
o.conn_spool:	OSLib:oslib.h.os
o.conn_spool:	OSLib:oslib.h.oscore32
o.conn_spool:	OSLib:oslib.h.osf32
o.conn_spool:	OSLib:oslib.h.fileswitch
o.conn_spool:	OSLib:oslib.h.fileswch32
o.conn_spool:	OSLib:oslib.h.osfind
o.conn_spool:	OSLib:oslib.h.osfind32
o.conn_spool:	OSLib:oslib.h.osgbpb
o.conn_spool:	OSLib:oslib.h.osgbpb32
o.conn_spool:	h.config
o.conn_spool:	h.rpfs
o.conn_spool:	C:h.kernel
o.conn_spool:	h.connection
o.conn_spool:	OSLib:oslib.h.os
o.conn_spool:	h.errors
o.conn_spool:	OSLib:oslib.h.os
o.conn_spool:	h.syslogf
o.conn_spool:	h.utils
o.conn_spool:	OSLib:oslib.h.types
o.errors:	c.errors
o.errors:	h.config
o.errors:	h.rpfs
o.errors:	C:h.kernel
o.errors:	h.errors
o.errors:	OSLib:oslib.h.os
o.errors:	OSLib:oslib.h.types
o.errors:	OSLib:oslib.h.oscore32
o.errors:	OSLib:oslib.h.osf32
o.fsentries:	c.fsentries
o.fsentries:	OSLib:oslib.h.os
o.fsentries:	OSLib:oslib.h.types
o.fsentries:	OSLib:oslib.h.oscore32
o.fsentries:	OSLib:oslib.h.osf32
o.fsentries:	C:h.kernel
o.fsentries:	h.config
o.fsentries:	h.rpfs
o.fsentries:	h.connection
o.fsentries:	OSLib:oslib.h.os
o.fsentries:	h.errors
o.fsentries:	OSLib:oslib.h.os
o.fsentries:	h.syslogf
o.fsentries:	h.utils
o.fsentries:	OSLib:oslib.h.types
o.fsentries:	h.veneers
o.fsentries:	C:h.kernel
o.rpfs:	cmhg.rpfs
o.rpfs:	OSLib:oslib.h.fileswitch
o.rpfs:	OSLib:oslib.h.types
o.rpfs:	OSLib:oslib.h.os
o.rpfs:	OSLib:oslib.h.oscore32
o.rpfs:	OSLib:oslib.h.osf32
o.rpfs:	OSLib:oslib.h.fileswch32
o.utils:	c.utils
o.utils:	h.errors
o.utils:	OSLib:oslib.h.os
o.utils:	OSLib:oslib.h.types
o.utils:	OSLib:oslib.h.oscore32
o.utils:	OSLib:oslib.h.osf32
o.utils:	h.syslogf
o.utils:	h.utils
o.utils:	OSLib:oslib.h.types
o.rpfs:	cmhg.rpfs
o.rpfs:	OSLib:oslib.h.fileswitch
o.rpfs:	OSLib:oslib.h.types
o.rpfs:	OSLib:oslib.h.os
o.rpfs:	OSLib:oslib.h.oscore32
o.rpfs:	OSLib:oslib.h.osf32
o.rpfs:	OSLib:oslib.h.fileswch32
o.module:	c.module
o.module:	C:h.kernel
o.module:	OSLib:oslib.h.osfscontrol
o.module:	OSLib:oslib.h.types
o.module:	OSLib:oslib.h.os
o.module:	OSLib:oslib.h.oscore32
o.module:	OSLib:oslib.h.osf32
o.module:	OSLib:oslib.h.fileswitch
o.module:	OSLib:oslib.h.fileswch32
o.module:	OSLib:oslib.h.osfsctrl32
o.module:	OSLib:oslib.h.os
o.module:	C:h.kernel
o.module:	h.config
o.module:	h.rpfs
o.module:	h.syslogf
o.syslogf:	c.syslogf
o.syslogf:	OSLib:oslib.h.syslog
o.syslogf:	OSLib:oslib.h.types
o.syslogf:	OSLib:oslib.h.os
o.syslogf:	OSLib:oslib.h.oscore32
o.syslogf:	OSLib:oslib.h.osf32
o.syslogf:	h.config
o.syslogf:	h.rpfs
o.syslogf:	C:h.kernel
